Skip to content

fix(test): unblock root pixi run test workflow#1978

Open
rparolin wants to merge 6 commits intoNVIDIA:mainfrom
rparolin:fix-pixi-run-test
Open

fix(test): unblock root pixi run test workflow#1978
rparolin wants to merge 6 commits intoNVIDIA:mainfrom
rparolin:fix-pixi-run-test

Conversation

@rparolin
Copy link
Copy Markdown
Collaborator

@rparolin rparolin commented Apr 25, 2026

Summary

pixi run test was failing end-to-end. Two stacked root causes:

  1. List-form pixi cmd arrays didn't expand $PIXI_ENVIRONMENT_NAME. The root test-* tasks dropped into each sub-package without forwarding the active environment, so the inner pixi run picked the sub-package's default environment. In cuda_bindings/pixi.toml and cuda_core/pixi.toml, default has no cuda-version pin — the conda solver resolved a CUDA-12.x toolkit, and the build failed compiling Cython output that references CUatomicOperation_enum (a CUDA-13.x-only symbol). Fix: wrap each test-* task in bash -c '…' so the shell expands $PIXI_ENVIRONMENT_NAME and forwards it explicitly via -e to the inner pixi run.

  2. Cython couldn't find cross-package .pxd files under pixi-build's editable install. pixi-build installs cuda-bindings via a PEP 660 finder hook; runtime imports honor it but Cython's filesystem .pxd resolver does not. Fix: replace the cythonize CLI invocation in both cuda_core/tests/cython/build_tests.sh and cuda_bindings/tests/cython/build_tests.sh with a small Python wrapper (build_tests.py) that calls Cython.Build.cythonize() with an explicit include_path resolved at runtime from cuda.bindings.__file__. This avoids platform-specific PYTHONPATH separator handling and surfaces missing-import failures as Python exceptions instead of silent fallbacks.

Files changed

  • pixi.toml — three test-* tasks switched to bash -c '…' form forwarding -e "$PIXI_ENVIRONMENT_NAME"; comment block expanded with rationale and Linux-only scope note.
  • cuda_core/tests/cython/build_tests.sh — adds set -euo pipefail; invokes new build_tests.py instead of the cythonize CLI; still owns CPLUS_INCLUDE_PATH / CL setup.
  • cuda_core/tests/cython/build_tests.pynew; resolves the cuda namespace package's parent dir at runtime and runs cythonize() + setup(... build_ext --inplace) with an explicit include_path.
  • cuda_bindings/tests/cython/build_tests.sh — adds set -euo pipefail; switches to the new wrapper; preserves CPLUS_INCLUDE_PATH / CL setup.
  • cuda_bindings/tests/cython/build_tests.pynew; mirror of the cuda_core wrapper, with nthreads=1 to preserve the previous -j 1 deterministic-build behavior.

🤖 Generated with Claude Code

`pixi run test` failed at the cuda_bindings build stage because list-form
pixi `cmd` arrays didn't expand `$PIXI_ENVIRONMENT_NAME` reliably, so the
inner per-package `pixi run` calls picked the cuda_bindings default
environment (no cuda-version pin). The conda solver then resolved
cuda-version=12.9 and the build failed with a missing `CUatomicOperation_enum`
(a CUDA-13.x-only symbol).

Wrap the three test-* tasks in `bash -c '...'` so the shell expands
`$PIXI_ENVIRONMENT_NAME` and forward it explicitly via `-e` to each inner
pixi run.

Once the bindings build was unblocked, cuda_core's cython test build hit a
second issue: `cythonize` cannot resolve `cimport cuda.bindings.*` against
pixi-build's editable install, which exposes the cuda namespace package via a
finder hook that Cython's filesystem .pxd resolver does not consult. Replace
the `cythonize` CLI invocation with a small Python wrapper that calls
`Cython.Build.cythonize()` with an explicit `include_path` resolved from the
imported `cuda.bindings` package.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin added this to the cuda.core v1.0.0 milestone Apr 25, 2026
@rparolin rparolin added bug Something isn't working CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module labels Apr 25, 2026
@rparolin rparolin requested a review from cpcloud April 25, 2026 08:13
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin self-assigned this Apr 25, 2026
Drop cuda_core/tests/cython/build_tests.py in favor of a small PYTHONPATH
shim in build_tests.sh. Same outcome (Cython's .pxd resolver finds
cuda.bindings via the package's parent directory), three lines instead of
a separate setuptools entry point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

@leofang leofang added the P1 Medium priority - Should do label May 1, 2026
Replace the PYTHONPATH shim in cuda_core/tests/cython/build_tests.sh
with a small Python driver (build_tests.py) that calls
Cython.Build.cythonize() with an explicit include_path resolved at
runtime from cuda.bindings.__file__. Avoids platform-specific
PYTHONPATH separator handling and surfaces missing-import failures
as Python exceptions instead of silent fallbacks.

Apply the same wrapper pattern to cuda_bindings/tests/cython/ for
symmetry; both shell scripts gain `set -eo pipefail` and `${VAR:-}`
defaults so the previously optional CPLUS_INCLUDE_PATH / CL env vars
keep working under stricter error mode.

Expand the pixi.toml comment block to document why each test-* task
is wrapped in `bash -c '...'` and note Linux-only scope.

Verified end-to-end: `pixi run test` passes 4,314 tests
(974 pathfinder + 384 bindings + 2,956 core), 208 skipped, 2 xfailed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label May 1, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin enabled auto-merge (squash) May 1, 2026 21:23
@rparolin rparolin requested a review from isVoid May 1, 2026 23:05
@rparolin
Copy link
Copy Markdown
Collaborator Author

rparolin commented May 1, 2026

Code review

No issues found. Checked for bugs and AGENTS.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@rparolin rparolin removed cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module labels May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CI/CD CI/CD infrastructure P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants